{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "<img src=\".\\\\diyLogo.png\" alt=\"some_text\">\n",
    "<h1> 第一讲 基本数据结构</h1>\n",
    "<a id=backup></a>\n",
    "<H2>目录</H2>  \n",
    "\n",
    "[1.1 数字常量](#Literals)   \n",
    "[1.2 标准数据类型](#data_type)   \n",
    "[1.3 数字类型的操作](#num_opr)   \n",
    "[1.4 字符串](#char_opr)   \n",
    "[1.5 Latex数学公式编辑](#Latex_form)   \n",
    "\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id=\"Literals\"></a>\n",
    "### 1.1 数字常量\n",
    "\n",
    "Python3 支持 **int、float、bool、complex**（复数）。\n",
    "\n",
    "在Python 3里，只有一种整数类型 **int**，表示为长整型，没有 python2 中的 **Long**。\n",
    "\n",
    "像大多数语言一样，数值类型的赋值和计算都是很直观的。\n",
    "\n",
    "内置的 type() 函数可以用来查询变量所指的对象类型。\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "试执行下列语句：   \n",
    "`z=2+5j`   \n",
    "`type(z)`    \n",
    "`print(z.conjugate())`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2-5j)\n"
     ]
    }
   ],
   "source": [
    "###\n",
    "z=2+5j  \n",
    "type(z)\n",
    "print(z.conjugate())\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "与数学中的整数概念一致，没有取值范围限制\n",
    "pow(x, y)函数：\n",
    "计算 $ x^{y} $  \n",
    "`pow(2,600)`\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4149515568880992958512407863691161151012446232242436899995657329690652811412908146399707048947103794288197886611300789182395151075411775307886874834113963687061181803401509523685376"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "###\n",
    "pow(2,600)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n",
      "sys.int_info(bits_per_digit=30, sizeof_digit=4)\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "print(sys.float_info)\n",
    "print(sys.int_info)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting whoisdomain\n",
      "  Downloading whoisdomain-1.20240129.1-py3-none-any.whl (64 kB)\n",
      "     -------------------------------------- 64.9/64.9 kB 501.5 kB/s eta 0:00:00\n",
      "Installing collected packages: whoisdomain\n",
      "Successfully installed whoisdomain-1.20240129.1\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "%pip install whoisdomain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import whois\n",
    "whois.__all__\n",
    "help(whois.query)\n",
    "domain = whois.query('google.com')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function query in module whoisdomain:\n",
      "\n",
      "query(domain: str, force: bool = False, cache_file: Optional[str] = None, cache_age: int = 172800, slow_down: int = 0, ignore_returncode: bool = False, server: Optional[str] = None, verbose: bool = False, with_cleanup_results: bool = False, internationalized: bool = False, include_raw_whois_text: bool = False, return_raw_text_for_unsupported_tld: bool = False, timeout: Optional[float] = None, parse_partial_response: bool = False, cmd: str = 'whois', simplistic: bool = False, withRedacted: bool = False, pc: Optional[whoisdomain.context.parameterContext.ParameterContext] = None, tryInstallMissingWhoisOnWindows: bool = False, shortResponseLen: int = 5, withPublicSuffix: bool = False, extractServers: bool = False, stripHttpStatus: bool = False, noIgnoreWww: bool = False) -> Optional[whoisdomain.domain.Domain]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import whoisdomain\n",
    "whoisdomain.__all__\n",
    "help(whoisdomain.query)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "import urllib3\n",
    "\n",
    "def download(url):\n",
    "    return urllib3.connection_from_url(url)\n",
    "url='www.baidu.com'\n",
    "re=download(url)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "help(urllib3.http_response)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Error querying example.com: 'module' object is not callable\n",
      "Error querying python.org: 'module' object is not callable\n",
      "Error querying google.com: 'module' object is not callable\n"
     ]
    }
   ],
   "source": [
    "import whois\n",
    "from concurrent.futures import ThreadPoolExecutor, as_completed\n",
    "\n",
    "def query_whois(domain):\n",
    "    try:\n",
    "        d = whois.whois(domain)\n",
    "        return {\n",
    "            'domain_name': d.domain_name,\n",
    "            'registrar': d.registrar,\n",
    "            'creation_date': d.creation_date,\n",
    "            'expiration_date': d.expiration_date,\n",
    "            'name_servers': d.name_servers,\n",
    "            'status': d.status,\n",
    "            'emails': d.emails,\n",
    "            'dnssec': d.dnssec,\n",
    "            'name': d.name,\n",
    "            'country': d.country,\n",
    "            'city': d.city,\n",
    "            'org': d.org,\n",
    "            'address': d.address\n",
    "        }\n",
    "    except Exception as e:\n",
    "        print(f\"Error querying {domain}: {e}\")\n",
    "        return None\n",
    "\n",
    "domains = ['example.com', 'python.org', 'google.com']\n",
    "\n",
    "# 使用多线程处理域名查询\n",
    "with ThreadPoolExecutor(max_workers=10) as executor:\n",
    "    futures = {executor.submit(query_whois, domain): domain for domain in domains}\n",
    "    for future in as_completed(futures):\n",
    "        domain = futures[future]\n",
    "        try:\n",
    "            info = future.result()\n",
    "            if info:\n",
    "                print(info)\n",
    "        except Exception as exc:\n",
    "            print(f'{domain} generated an exception: {exc}')\n",
    "\n",
    "\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id=\"data_type\"></a>\n",
    "## 1.2 标准数据类型\n",
    "<h3 style=\"color:green\"> Python3 中有六个标准的数据类型：</h3>\n",
    "  \n",
    "<table border=\"1\">\n",
    "    <tr>\n",
    "        <td> Number</td>\n",
    "        <td>数字</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "        <td>String</td>\n",
    "        <td>字符串</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "        <td>List</td>\n",
    "        <td>列表</td>\n",
    "    </tr>    \n",
    "    <tr>\n",
    "        <td>Tuple</td>\n",
    "        <td>元组</td>\n",
    "    </tr>    \n",
    "    <tr>\n",
    "        <td>Set</td>\n",
    "        <td>集合</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "        <td>Dictionary</td>\n",
    "        <td>字典</td>\n",
    "    </tr>\n",
    "</table>\n",
    "<h3 style=\"color:green\">Python3 的六个标准数据类型中：</h3>\n",
    "\n",
    "不可变数据（3 个）：Number（数字）、String（字符串）、Tuple（元组）；  \n",
    "可变数据（3 个）：List（列表）、Dictionary（字典）、Set（集合）。  \n",
    "\n",
    "[目录](#backup) "
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "试执行下列语句：   \n",
    "```\n",
    "counter = 100       # 整型变量\n",
    "miles = 1000.0      # 浮点型变量\n",
    "name = \"ru'n'oob\"   # 字符串\n",
    "name2='xauat\"edu\"'\n",
    "name3='''a \n",
    "b\n",
    " c '''\n",
    "list1  = [1, 2, 3, 4, 5] # 列表\n",
    "tup1 = (1, 2, 3, 4, 5)  # 元 组\n",
    "dict = {'name': '张三', 'age': 15, 'Mail': 'zhs@163.com'} # 字典\n",
    "basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} # 集合\n",
    "print(counter)\n",
    "print(miles)\n",
    "print(name)\n",
    "print(basket)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "###"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id=\"num_opr\"></a>\n",
    "## 1.3 数字类型的操作\n",
    "数值计算+ - * /\n",
    "\n",
    "[目录](#backup) "
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "试执行下列语句：   \n",
    "````\n",
    "a = b = 1\n",
    "c=a+b\n",
    "print(\"a+b=\", c)\n",
    "c=a*b\n",
    "print(\"a*b=\", c)\n",
    "a=8\n",
    "b=3\n",
    "c=a/b\n",
    "print(\"a/b=\", c)\n",
    "c=a//b\n",
    "print(\"a//b=\", c)\n",
    "c = a%b\n",
    "print(\"a%b =\", c)\n",
    "c = a ** b\n",
    "print(\"a**b=\", c)\n",
    "````"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "###"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id=\"char_opr\"></a>\n",
    "## 1.4 字符串变量操作\n",
    "字符串是 Python 中最常用的数据类型。我们可以使用引号( ' 、 \" 或 ''')来创建字符串。\n",
    "\n",
    "创建字符串很简单，只要为变量分配一个值即可。例如：\n",
    "\n",
    "[目录](#backup) "
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "试执行下列语句：   \n",
    "````\n",
    "var1 = 'Hello World!'\n",
    "var2 = \"Runoob\"\n",
    "var3='''Hello World '''\n",
    "````"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "###"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Python 访问字符串中的值\n",
    "Python 不支持单字符类型，单字符在 Python 中也是作为一个字符串使用。\n",
    "\n",
    "Python 访问子字符串，可以使用方括号 [] 来截取字符串，字符串的截取的语法格式如下：\n",
    "`print(var1[1:5])'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "###\n",
    "        "
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "[目录](#backup) "
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<a id=\"Latex_form\"></a>\n",
    "## 1.5 Latex数学公式编辑\n",
    "在jupyter notebook使用latex编辑数学公式\n",
    "使用下划线_表示下标，使用^表示上标: $X={\\ x}^{a} \n",
    "d\\varPsi = \\int_{a}^{b} \\ x_i \\,d\\alpha $\n",
    "\n",
    "[目录](#backup) "
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$x_{(22)}^{(n)}\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$x_{(22)}^{(n)}\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\frac{1}{1+\\frac{1}{2}}\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\frac{1}{1+\\frac{1}{2}}\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\sqrt{1+\\sqrt[^p]{1+a^2}}\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\sqrt{1+\\sqrt[^p]{1+a^2}}\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\int_1^\\infty\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\int_1^\\infty\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\sum_{k=1}^n\\frac{1}{k}\\qquad $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\int_a^b f(x)dx\\qquad$"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\frac{\\partial E_w}{\\partial w}\\qquad $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\lim_{1\\to\\infty}\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\lt \\gt \\le \\ge \\neq \\not\\lt \\neq\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\times \\div \\pm \\mp x \\cdot y\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\cup \\cap \\setminus \\subset \\subseteq \\subsetneq \\supset \\in \\notin \\emptyset   \\varnothing\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\to \\rightarrow \\leftarrow \\Rightarrow \\Leftarrow \\mapsto\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\land \\lor \\lnot \\forall \\exists \\top \\bot \\vdash \\vDash\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\star \\ast \\oplus \\circ \\bullet\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\approx \\sim \\cong \\equiv \\prec\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\infty \\aleph \\nabla \\partial\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\epsilon \\varepsilon\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\phi \\varphi\\qquad $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\left \\lbrace \\sum_{i=0}^n i^2 = \\frac{(n^2+n)(2n+1)}{6} \\right\\rbrace \\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\left( \\sum_{k=\\frac{1}{2}}^{N^2}\\frac{1}{k} \\right)\\qquad $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\left. \\frac{\\partial f(x, y)}{\\partial x}\\right|_{x=0}\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\left. \\frac{\\partial f(x, y)}{\\partial x}\\right|_{x=0}\\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\left\\lbrace\\begin{aligned}a\\\\b\\\\c\\\\\\end{aligned}\\right\\rbrace \\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$\\left\\lbrace\\begin{aligned}a\\\\b\\\\c\\\\\\end{aligned}\\right\\rbrace \\qquad  $"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\\left\\lbrace\\begin{aligned}  \n",
    "a_1x+b_1y+c_1z &=d_1+e_1 \\\\\\ \n",
    "a_2x+b_2y &=d_2 \\\\\\ \n",
    "a_3x+b_3y+c_3z &=d_3\n",
    "\\end{aligned}\\right\\rbrace \\qquad  $$\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数值类型实例"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<table><tr><th>int</th><th>long</th><th>float</th><th>complex</th></tr>\n",
    "<tr><td>10</td><td>51924361L</td><td>0.0</td><td>3.14j</td></tr>\n",
    "<tr><td>100</td><td>-0x19323L</td><td>15.20</td><td>45.j</td></tr>\n",
    "<tr><td>-786</td><td>0122L</td><td>-21.9</td><td>9.322e-36j</td></tr>\n",
    "<tr><td>080</td><td>0xDEFABCECBDAECBFBAEl</td><td>32.3e+18</td><td>.876j</td></tr>\n",
    "<tr><td>-0490</td><td>535633629843L</td><td>-90.</td><td>-.6545+0J</td></tr>\n",
    "<tr><td>-0x260</td><td>-052318172735L</td><td>-32.54e100</td><td>3e+26J</td></tr>\n",
    "<tr><td>0x69</td><td>-4721885298529L</td><td>70.2E-12</td><td>4.53e-7j</td></tr>\n",
    "</table>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "(1)质量 M 和 m 两个物体(可视为质点)只受万有引力作用，最开始相对静止，相距 L求两个物体相碰的时间.     \n",
    "(2)如果在两个物体之间连一根劲度系数为 k、原长L 的弹簧，假设弹簧长度可以缩短为 0，那么 k 满足什么条件时，两个物体才不会相碰?    \n",
    "$$\\begin{align*}\n",
    "&u= (\\frac{M}{M+m})l - x\\\\\n",
    "&\\frac{1}{2}k\\left(\\frac{M+m}{m}\\right)^2 u^2 - \\frac{G \\frac{M^3m}{(M+m)^3}}{u} = -\\frac{G M^2 m}{(M+m)L}\n",
    "\\end{align*}$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%pip install sympy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import symbols, Eq, solve\n",
    "\n",
    "# 定义变量\n",
    "M, m, l, x, u, k, G, L = symbols('M m l x u k G L')\n",
    "\n",
    "# 构建方程组\n",
    "equation1 = Eq(u, (M / (M + m)) * l - x)\n",
    "equation2 = Eq((1 / 2) * k * ((M + m) / m) ** 2 * u ** 2 - G * M ** 3 * m / ((M + m) ** 3 * u), -G * M ** 2 * m / ((M + m) * L))\n",
    "\n",
    "# 求解方程组\n",
    "solutions = solve((equation1, equation2), (u, M, m, l, x, k, G, L), dict=True)\n",
    "\n",
    "# 输出解（注意：由于方程组复杂，可能无法得到显式解，或解可能包含多个变量）\n",
    "for sol in solutions:\n",
    "    print(sol)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$u={10LM^3km^2z^3 + 10LM^2km^3z^3 + 5LM^4kmz^3 + 5Lkm^4Mz^3 + Lkm^5z^3 + LM^5kz^3 - 4GM^3m^4z - 2GM^4m^3z - 2GM^2m^5z - 2GLM^3m^3}$$"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "python311",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
